//
//  CYBaseViewController+Button.m
//  CYBaseKit
//
//  Created by admin on 2022/10/8.
//

#import "UIViewController+Button.h"

#import "CYBaseKitHelper.h"

@implementation UIViewController (Button)

- (UIButton *)defaultNavLeftBtn {
    return [self defaultNavLeftBtnWithAction:nil];
}

- (UIButton *)defaultNavLeftBtnWithAction:(SEL)action {
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(0, 0, 44, 44);
    button.titleLabel.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize]];
    button.titleLabel.textColor = [UIColor whiteColor];
    button.titleLabel.shadowOffset = CGSizeMake(0, -1);
    button.titleLabel.shadowColor = [UIColor darkGrayColor];
    button.tintColor = [UIColor whiteColor];
    UIImage *leftImage = [CYBaseKitHelper cy_module_imageWithName:@"cy_nav_left_back_default.png.png"];
    [button setBackgroundImage:leftImage forState:UIControlStateNormal];
    [button setBackgroundImage:leftImage forState:UIControlStateHighlighted];
    if (action) {
        [button addTarget:self action:action forControlEvents:UIControlEventTouchUpInside];
    } else {
        [button addTarget:self action:@selector(backDefaultAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return button;
}

- (UIButton *)defaultNavRightBtnBoxWithAction:(SEL)action {
    UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeCustom];

    rightButton.frame = CGRectMake(0, 0, 70, 44);
    [rightButton addTarget:self action:action forControlEvents:UIControlEventTouchUpInside];

    return rightButton;
}
@end
